import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'

import path from "path"; //这个path用到了上面安装的@types/node

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        vueJsx(), // 注册插件
    ],
    resolve: {
        alias: {
            "@": path.resolve("./src"), // @代替src
            "#": path.resolve("./types"), // #代替types
        },
    },
    server: {
        cors: true, // 允许跨域
        port: 5173,
        proxy: (() => {
            // http://192.168.16.47:9006/swagger/index.html
            //const target = 'http://10.0.10.154:7085/';
            // const target = 'http://10.0.10.154:7085/';
            // const target = 'http://192.168.5.143:7085/';
            const target = 'http://localhost:7085/';
            // const target = 'http://192.168.0.112:7085/'
            // const target = 'http://192.168.5.140:7085';
            return {
                "/Api": {
                    target,
                    changeOrigin: true,
                },
            }
        })()
    }
})
